package com.hospital.hospitalserver.controller;

import com.hospital.hospitalserver.entity.demo.MedicalDTO;
import com.hospital.hospitalserver.service.MedicalInsuranceService;
import com.hospital.hospitalserver.util.Response;
import jdk.jfr.Frequency;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * 模拟医保账户API调用验证
 * */
@CrossOrigin
@RestController
@RequiredArgsConstructor
@RequestMapping("/medical")
public class MedicalInsuranceController {
    private final MedicalInsuranceService medicalInsuranceService;

    /**
     * 模拟查询医保二维码
     * 用于生成二维码和条形码
     * */
    @PostMapping("/queryCardNumber")
    public Response queryMedicalByInsuranceCardNumber(@RequestBody MedicalDTO request){
        System.out.println(request.getInsurance_card_number());
        return medicalInsuranceService.queryMedicalByInsuranceCardNumber(request.getInsurance_card_number());
    }

    /**
     * 根据二维码卡号查询用户基础信息
     * */
    @PostMapping("/queryQrCode")
    public Response queryMedicalByQrCode(@RequestBody MedicalDTO request){
        return medicalInsuranceService.queryMedicalByQrCode(request);
    }
}
